/**
 * Project Name:gc.sms.mvn
 * File Name:ResponseResult.java
 * Package Name:com.clps.dev.sms.common.result
 * @date 2018-12-07 15:39:56 
 * Copyright (c) 2018, www.clpsglobal.com All Rights Reserved.
 *
 */
package com.clps.dev.sms.common.result;

import java.io.Serializable;
import java.util.List;

import com.clps.dev.sms.util.page.PageBean;
import com.clps.dev.sms.util.tree.TreeBean;



/**
 * @ClassName: ResponseResult <br/><br/>
 * @Description:  将返回结果统一的封装在对象中
 * 
 * state:根据http协议生成的状态码 比如：404
 * message:提示信息  比如： 更新失败
 * data:数据
 * pageInfo:分页信息
 * treeInfo:树形结构信息
 * 
 * @date 2018-12-07 15:39:56  <br/>
 *
 * @author long.ma
 * @version V1.0
 * @param <T>
 * @since JDK 1.8
 */
public class ResponseResult<T> implements Serializable {

	/**
	 * serialVersionUID:
	 * @since JDK 1.8
	 */
	private static final long serialVersionUID = 1L;
	
	
	private Integer state;                   //根据http协议生成的状态码 比如：404
    private String message;                  //提示信息  比如： 更新失败
    private Object data;                     //数据
    private PageBean<T> pageInfo;            //分页信息
    private List<TreeBean<T>> treeInfo;            //树形结构信息
    
    /**
	 * Creates a new instance of ResponseResult.
	 *
	 */

	public ResponseResult() {
		 
	}


	/**
	 * Creates a new instance of ResponseResult.
	 *
	 * @param state
	 * @param message
	 * @param data
	 * @param pageInfo
	 */
	
	public ResponseResult(Integer state, String message, Object data, PageBean<T> pageInfo,List<TreeBean<T>> treeInfo) {
		super();
		this.state = state;
		this.message = message;
		this.data = data;
		this.pageInfo = pageInfo;
		this.treeInfo=treeInfo;
	}
	
	
	/**
	 * state.
	 *
	 * @return  the state
	 * @since   JDK 1.8
	 */
	public Integer getState() {
		return state;
	}


	/**
	 * state.
	 *
	 * @param   state    the state to set
	 * @since   JDK 1.8
	 */
	public void setState(Integer state) {
		this.state = state;
	}


	/**
	 * message.
	 *
	 * @return  the message
	 * @since   JDK 1.8
	 */
	public String getMessage() {
		return message;
	}


	/**
	 * message.
	 *
	 * @param   message    the message to set
	 * @since   JDK 1.8
	 */
	public void setMessage(String message) {
		this.message = message;
	}


	/**
	 * data.
	 *
	 * @return  the data
	 * @since   JDK 1.8
	 */
	 
	public Object getData() {
		return   data;
	}


	/**
	 * data.
	 *
	 * @param   data    the data to set
	 * @since   JDK 1.8
	 */
	public void setData(Object data) {
		this.data = data;
	}


	/**
	 * pageInfo.
	 *
	 * @return  the pageInfo
	 * @since   JDK 1.8
	 */
	public PageBean<T>  getPageInfo() {
		return pageInfo;
	}


	/**
	 * pageInfo.
	 *
	 * @param   pageInfo    the pageInfo to set
	 * @since   JDK 1.8
	 */
	public void setPageInfo(PageBean<T> pageInfo) {
		this.pageInfo = pageInfo;
	}

	

	/**
	 * treeInfo.
	 *
	 * @return  the treeInfo
	 * @since   JDK 1.8
	 */
	public List<TreeBean<T>> getTreeInfo() {
		return treeInfo;
	}


	/**
	 * treeInfo.
	 *
	 * @param   treeInfo    the treeInfo to set
	 * @since   JDK 1.8
	 */
	public void setTreeInfo(List<TreeBean<T>> treeInfo) {
		this.treeInfo = treeInfo;
	}


	/**
	 *
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((data == null) ? 0 : data.hashCode());
		result = prime * result + ((message == null) ? 0 : message.hashCode());
		result = prime * result + ((pageInfo == null) ? 0 : pageInfo.hashCode());
		result = prime * result + ((state == null) ? 0 : state.hashCode());
		result = prime * result + ((treeInfo == null) ? 0 : treeInfo.hashCode());
		return result;
	}


	/**
	 *
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		@SuppressWarnings("unchecked")
		ResponseResult<T> other = (ResponseResult<T>) obj;
		if (data == null) {
			if (other.data != null)
				return false;
		} else if (!data.equals(other.data))
			return false;
		if (message == null) {
			if (other.message != null)
				return false;
		} else if (!message.equals(other.message))
			return false;
		if (pageInfo == null) {
			if (other.pageInfo != null)
				return false;
		} else if (!pageInfo.equals(other.pageInfo))
			return false;
		if (state == null) {
			if (other.state != null)
				return false;
		} else if (!state.equals(other.state))
			return false;
		if (treeInfo == null) {
			if (other.treeInfo != null)
				return false;
		} else if (!treeInfo.equals(other.treeInfo))
			return false;
		return true;
	}


	/**
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "ResponseResult [state=" + state + ", message=" + message + ", data=" + data + ", pageInfo=" + pageInfo
				+ ", treeInfo=" + treeInfo + "]";
	}


	
}
